<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            margin: 30px;
            border: 5px solid #000;
            padding: 20px;
            width: 200px;
            height: 100px;
            /* box-sizing: border-box;IE盒模型 */
            /* box-sizing: content-box;标准盒模型 */
        }
    </style>
</head>
<body>
    <div id="wrap" style="width: 200px; height:100px">hello world</div>

    <script>
    let dom = document.getElementById('wrap')
    // wrap.style.width = 300 + 'px'
    // console.log(dom.style.width);

    // dom.offsetWidth = 300 + 'px'  无效
    // console.log(dom.offsetWidth);
    
    // dom.getBoundingClientRect().width = 300 + 'px'  无效
    // console.log(dom.getBoundingClientRect());
   
//     window.getComputedStyle(dom).width = 300 + 'px'  无效
//    console.log(window.getComputedStyle(dom).width);

// console.log(dom.currentStyle.width);  //能获取但只支持IE
    </script>
</body>
</html>